package com.jwds.digital.bios.business.service.rule.impl;

import com.jwds.digital.bios.business.core.constants.RuleCodeConstant;
import com.jwds.digital.bios.business.core.infrastructure.dto.dispatch.DispatchParameterReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.dto.feign.model.BeltScaleDTO;
import com.jwds.digital.bios.business.core.infrastructure.dto.feign.model.FeederStatusDTO;
import com.jwds.digital.bios.business.core.infrastructure.vo.feign.BasicStockBinRespVO;
import com.jwds.digital.bios.business.rpc.feign.RealTimeDataFeign;
import com.jwds.digital.bios.business.service.rule.DispatchRuleSortInterface;
import com.jwds.tdc.framework.application.lib.BaseResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 高炉运行先后
 * @author 李志明
 */
@Slf4j
@Component
public class BlastFurnaceOperation implements DispatchRuleSortInterface {

    @Autowired
    RealTimeDataFeign realTimeDataFeign;

    @Override
    public String getRuleCode() {
        return RuleCodeConstant.BLAST_FURNACE_OPERATION;
    }

    @Override
    public List<DispatchParameterReqDTO> sortProcess(List<DispatchParameterReqDTO> dataList) {
        ArrayList<DispatchParameterReqDTO> feederStatusDTOS = new ArrayList<>();
        for (DispatchParameterReqDTO dispatchParameterReqDTO : dataList) {
            String collect = dispatchParameterReqDTO.getSlot().getSlotCode();
            BaseResponse<FeederStatusDTO> feederStatusDTOBaseResponse = realTimeDataFeign.queryOneFeederStatusData(collect);
            // @TODO 先根据圆盘运行
            if (feederStatusDTOBaseResponse.getData().getDiscFcRun()) {
                feederStatusDTOS.add(dispatchParameterReqDTO);
            }
        }
        return feederStatusDTOS;
    }
}
